<?php
defined('IN_ADMIN') or exit('No permission resources.');
include $this->admin_tpl('header','admin');
?>
<script type="text/javascript">
<!--
	$(function(){
	    $.formValidator.initConfig({formid:"myform",autotip:true,onerror:function(msg,obj){window.top.art.dialog({content:msg,lock:true,width:'200',height:'50'}, function(){this.close();$(obj).focus();})}});
	    $("#title").formValidator({onshow:"<?php echo L("input").L('title')?>",onfocus:"<?php echo L("input").L('title')?>"}).inputValidator({min:1,onerror:"<?php echo L("input").L('title')?>"});
	    $("#thumb").formValidator({onshow:"<?php echo L("input").L('thumb')?>",onfocus:"<?php echo L("input").L('thumb')?>"}).inputValidator({min:1,onerror:"<?php echo L("input").L('thumb')?>"});
 	    $("#picture_fast_url").formValidator({onshow:"<?php echo L("input").L('url')?>",onfocus:"<?php echo L("input").L('url')?>"}).inputValidator({min:1,onerror:"<?php echo L("input").L('url')?>"}).regexValidator({regexp:"^http:\/\/[A-Za-z0-9]+\.[A-Za-z0-9]+[\/=\?%\-&]*([^<>])*$",onerror:"<?php echo L('picture_fast_onerror')?>"})
        $('#style').formValidator({onshow:"<?php echo L('select_style')?>",onfocus:"<?php echo L('select_style')?>",oncorrect:"<?php echo L('right_all')?>"}).inputValidator({min:1,onerror:"<?php echo L('select_style')?>"});
	})
//-->
</script>

<div class="pad_10">
<form action="?m=picture_fast&c=picture_fast&a=add" method="post" name="myform" id="myform">
<table cellpadding="2" cellspacing="1" class="table_form" width="100%">

    <tr>
        <th width="20%"><?php echo L('catid')?>：</th>
        <td><select name="picture_fast[catid]" id="">
                <option value="0">默认栏目</option>
                <?php
                $i=0;
                foreach($cates as $catid=>$cate){
                    $i++;
                    ?>
                    <option value="<?php echo $cate['catid'];?>"><?php echo $cate['catname'];?></option>
                <?php }?>
            </select></td>
    </tr>
	<tr>
		<th width="20%"><?php echo L('typeid')?>：</th>
		<td><select name="picture_fast[typeid]" id="">
		<option value="0">默认分类</option>
		<?php
		  $i=0;
		  foreach($types as $typeid=>$type){
		  $i++;
		?>
		<option value="<?php echo $type['typeid'];?>"><?php echo $type['name'];?></option>
		<?php }?>
		</select></td>
	</tr>
	
	<tr>
		<th width="100"><?php echo L('title')?>：</th>
		<td><input type="text" name="picture_fast[title]" id="title"
			size="30" class="input-text"></td>
	</tr>

	<tr id="thumb_picture_fast">
		<th width="100"><?php echo L('thumb')?>：</th>
		<td><?php echo form::new_images('picture_fast[thumb]', 'thumb', '', 'picture_fast')?></td>
	</tr>

 
	<tr>
		<th><?php echo L('content')?>：</th>
		<td><textarea name="picture_fast[content]" id="content" cols="50"
			rows="6"></textarea></td>
	</tr>

    <tr>
        <th width="100"><?php echo L('editor')?>：</th>
        <td><input type="text" name="picture_fast[editor]" id="picture_fast_editor"
                   size="30" class="input-text"></td>
    </tr>

    <tr>
        <th><strong><?php echo L('available_style')?>：</strong></th>
        <td>
            <?php echo form::select($template_list, $info['default_style'], 'name="picture_fast[style]" id="style" onchange="load_file_list(this.value)"', L('please_select'))?>
        </td>
    </tr>
    <tr>
        <th><strong><?php echo L('template_select')?>：</strong></th>
        <td id="show_template"><script type="text/javascript">$.getJSON('?m=admin&c=category&a=public_tpl_file_list&style=<?php echo $info['default_style']?>&module=picture_fast&templates=show&name=picture_fast&pc_hash='+pc_hash, function(data){$('#show_template').html(data.show_template);});</script></td>
    </tr>

    <tr>
        <th><?php echo L('passed')?>：</th>
        <td><input name="picture_fast[status]" type="radio" value="99" checked>&nbsp;<?php echo L('yes')?>&nbsp;&nbsp;<input
                    name="picture_fast[status]" type="radio" value="1">&nbsp;<?php echo L('no')?></td>
    </tr>
<tr>
		<th></th>
		<td><input type="hidden" name="forward" value="?m=picture_fast&c=picture_fast&a=add"> <input
		type="submit" name="dosubmit" id="dosubmit" class="dialog"
		value=" <?php echo L('submit')?> "></td>
	</tr>

</table>
</form>
</div>
</body>
</html>
<script type="text/javascript">
    function load_file_list(id) {
        if (id=='') return false;
        $.getJSON('?m=admin&c=category&a=public_tpl_file_list&style='+id+'&module=picture_fast&templates=show&name=picture_fast&pc_hash='+pc_hash, function(data){$('#show_template').html(data.show_template);});
    }
</script>